/*
 * @Description:
 * @Version: 1.0
 * @Author: Will
 * @Date: 2022-04-06 13:23:46
 * @LastEditors: MarsLay 331412466@qq.com
 * @LastEditTime: 2024-01-15 13:51:57
 * @FilePath: \nanhu-manage-pc\src\router\index.js
 * Copyright (C) 2022 Will. All rights reserved.
 */
import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "toIndex",
    component: () => import("../pages/index/Index.vue"),
    children: [
      {
        path: "/login",
        name: "tologin",
        component: () => import("../pages/common/toLogin.vue"),
      },
      {
        path: "/efo",
        name: "toEfo",
        component: () => import("../pages/index/EFO.vue"),
      },
      {
        path: "/bom",
        name: "toBom",
        component: () => import("../pages/index/BOM.vue"),
      },
      {
        path: "/outbound",
        name: "toOutbound",
        component: () => import("../pages/index/Outbound.vue"),
      },
      {
        path: "/analysis",
        name: "toAnalysis",
        component: () => import("../pages/index/Analysis.vue"),
      },
    ],
  },
];

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes,
});

export default router;
